<script>

    //打印

    $('report').addEvent('click', function () {

        var limit_beg = $('limit_beg').get('value');

        var limit_end = $('limit_end').get('value');

        var begin_date = $('begin_date').get('value');

        var end_date = $('end_date').get('value');

        var shop_id = $('shop_id').get('value');

        var data_type = $('data_type').get('value');

        var materiaBn = $('materiaBn').get('value');

        var customer_name=$('customer').get('value');

        var url = "index.php?app=omeanalysts&ctl=analysis_mxreport&act=report";

        // var url="index.php?app=omeanalysts&ctl=analysis_mxreport&act=index&_finder%5Bfinder_id%5D=d58620&action=export&finder_aliasname=order_view1&finder_id=d58620";
        url += '&data_type=' + data_type + '&shop_id=' + shop_id + '&begin_date=' + begin_date + '&end_date=' + end_date + '&limit_beg=' + limit_beg + '&limit_end=' + limit_end + '&materiaBn=' + materiaBn+'&customer_name='+customer_name;
        window.open(url);

    });


</script>

<div class="tableform">

    <h3>订单跟踪明细表</h3>

    <h4>订单总额 = 订单货品总额 + 订单配送费用 + 订单保价费用 + 订单税金 + 订单折扣【订单折扣或涨价，在数据表中有正负号，可折增，折减】- （ 商品级别促销优惠 + 订单级别促销优惠 ）</h4>

    <h4>订单实际支付金额 = （优惠后发货销售单价 + 发货配送费用金额）* 发货数量 + （优惠后发货销售单价 + 发货配送费用金额）* 发货数量 + ...</h4>

    <h4>单个SKU优惠总金额 = 商品级别促销优惠摊分到该SKU金额 + 订单级别促销优惠摊分到每个SKU金额 + 订单折扣费用摊分到每个SKU金额 </h4>

    <h4>已支付金额 = 订单实际支付金额 - 退款金额</h4>

    <form id="Searchform" action="index.php?app=omeanalysts&ctl=analysis_mxreport&act=index" method="post">

        <div class="division">

            <table width='100%' cellspacing="0" cellpadding="0">

                <tr>

                    <td>

                        店铺：

                        <select name="shop_id" id="shop_id">

                            <option value="">全部</option>

                            <{foreach from=$shop_data key=key item=val}>

                            <option value="<{$key}>"
                            <{if $key==$clearingtable.shop_id}>selected<{/if}> ><{$val}></option>

                            <{/foreach}>

                        </select>
                        客户：
                        <select name="customer_name" id="customer">
                            <option value="">全部</option>
                            <{foreach from=$customerList key=key item=val}>
                            <option value="<{$val.customername}>"
                            <{if $val.customername ==$clearingtable.customer_name }>selected<{/if}> >
                            <{$val.customername}>
                            </option>
                            <{/foreach}>
                        </select>
                        物料编码：
                        <{input type="text" value="{$materiaBn}" style="width:110px;" name="materiaBn" id="materiaBn"}>

                        <br/>

                        <select name="data_type" id="data_type">

                            <option value="pay"
                            <{if 'pay'==$clearingtable.data_type}>selected<{/if}> >付款日期</option>

                            <option value="send"
                            <{if 'send'==$clearingtable.data_type}>selected<{/if}> >发货日期</option>

                        </select>

                        从：<{input type="date" name="begin_date" vtype="required" id="begin_date" style="width:110px;"
                        value="{$clearingtable.begin_date}" }>

                        至：<{input type="date" value="{$clearingtable.end_date}" style="width:110px;" id="end_date"
                        name="end_date"}>

                        <{input type="hidden" value="{$limit_beg}" style="width:110px;" name="limit_beg"
                        id="limit_beg"}>

                        <{input type="hidden" value="{$limit_end}" style="width:110px;" name="limit_end"
                        id="limit_end"}>

                        <{button class="btn btn-primary" type="submit" id="saveCurrent" label="查询"}>

                        <{button class="btn btn-primary" type="button" id="report" label="导出"}>

                        <{button class="btn btn-primary" type="button" id="print" label=".."}>

                    </td>

                </tr>

            </table>

        </div>

    </form>

    <!--     <a label="导出" href="javascript:void(0);" submit="index.php?app=ome&ctl=admin_order&act=index&_finder%5Bfinder_id%5D=d58620&action=export&finder_aliasname=order_view1&finder_id=d58620" target="dialog::{width:600,height:300,title:'导出'}">
                <span>导出</span>
        </a> -->

    <div class="division" id="accordion">

        <table width='100%' cellspacing="0" cellpadding="0" class="gridlist">

            <thead>

            <tr>

                <th>店铺名称</th>

                <th>订单号</th>

                <th>订单生成类型</th>
                
                <th>货号</th>

                <th>宝贝名称</th>

                <th>进度状态</th>

                <th>单位</th>

                <th>订单数量</th>

                <th>发货数量</th>

                <th>下单时间</th>

                <th>订单发货时间</th>

                <th>备货数量</th>

                <th>备货时间</th>

                <th>订单支付状态</th>


                <th>订单销售价</th><!--订单总额-->

                <th>订单原价</th><!--订单货品总额-->

                <th>配送费用</th><!--订单配送费用-->

                <th>保价费用</th><!--订单保价费用-->

                <th>税金</th><!--订单税金-->

                <th>折扣</th><!--订单折扣-->

                <th>商品促销优惠</th><!--商品级别促销优惠-->

                <th>整笔订单促销优惠</th><!--订单级别促销优惠-->

                <th>优惠后订单金额</th><!--订单已支付金额-->

                <th>订单已退款金额</th><!--订单已退款金额-->


                <!--

                <th>货品总金额</th>

                <th>货品成本价</th>

                <th>货品购买单价</th>

                <th>货品销售总金额</th>

                <th>货品优惠总金额</th>

                <th>货品总数量</th>

                <th>货品已发货数量</th>

                <th>货品已退货数量</th>

                -->

                <th>商品优惠分摊</th><!--商品级别促销优惠摊分到该SKU金额-->

                <th>整笔订单优惠分摊</th><!--订单级别促销优惠摊分到每个SKU金额-->

                <th>折扣费用分摊</th><!--订单折扣费用摊分到每个SKU金额-->

                <th>配送费用分摊</th><!--订单配送费用摊分到每个SKU金额-->

                <th>保价费用分摊</th><!--订单保价费用摊分到每个SKU金额-->

                <th>税金分摊</th><!--订单税金费用摊分到每个SKU金额-->

                <th>分摊汇总</th><!--单个SKU优惠总金额-->

                <!--

                <th>发货销售总金额</th>

                <th>发货销售单价</th>

                -->

                <th>优惠后发货金额</th><!--优惠后发货销售总金额-->

                <th>优惠后发货单价</th><!--优惠后发货销售单价-->

                <th>货品原价</th>

                <th>发货配送费用</th><!--发货配送费用金额-->


                <th>AX销售订单号</th>

                <th>AX送货单号</th>

                <th>快递单号</th>

                <th>快递公司</th>

                <th>退款确认时间</th>

                <th>退款数量</th>

                <th>退款金额</th>

                <th>备注</th>

                <th>地区</th>

                <th>地址</th>

            </tr>

            </thead>

            <tbody>

            <{foreach from=$datas key=key item=val}>

            <tr>

                <td style="white-space: nowrap;"><{$val.shop_name}></td>

                <td style="white-space: nowrap;"><{$val.order_bn}></td>

                <td style="white-space: nowrap;"><{$val.createway}></td>

                <td style="white-space: nowrap;"><{$val.order_items_bn}></td>

                <td style="white-space: nowrap;"><{$val.order_items_name}></td>

                <td style="white-space: nowrap;"><{$val.status}></td>

                <td style="white-space: nowrap;"><{$val.unit}></td>


                <td style="white-space: nowrap;"><{$val.order_items_nums}></td>

                <td style="white-space: nowrap;"><{$val.delivery_detail_number}></td>

                <td style="white-space: nowrap;"><{$val.paytime}></td>

                <td style="white-space: nowrap;"><{$val.ax_time}></td>

                <td style="white-space: nowrap;"><{$val.delivery_detail_number}></td>

                <td style="white-space: nowrap;"><{$val.create_time}></td>

                <td style="white-space: nowrap;"><{$val.pay_status}></td>


                <td style="white-space: nowrap;"><{$val.total_amount}></td>

                <td style="white-space: nowrap;"><{$val.cost_item}></td>

                <td style="white-space: nowrap;"><{$val.cost_freight}></td>

                <td style="white-space: nowrap;"><{$val.cost_protect}></td>

                <td style="white-space: nowrap;"><{$val.cost_tax}></td>

                <td style="white-space: nowrap;"><{$val.discount}></td>

                <td style="white-space: nowrap;"><{$val.pmt_goods}></td>

                <td style="white-space: nowrap;"><{$val.pmt_order}></td>

                <td style="white-space: nowrap;"><{$val.payed}></td>

                <td style="white-space: nowrap;"><{$val.refunds_money}></td>

                <!--

                <td style="white-space: nowrap;"><{$val.order_items_amount}></td>

                <td style="white-space: nowrap;"><{$val.order_items_cost}></td>

                <td style="white-space: nowrap;"><{$val.order_items_price}></td>

                <td style="white-space: nowrap;"><{$val.order_items_sale_price}></td>

                <td style="white-space: nowrap;"><{$val.order_items_pmt_price}></td>

                <td style="white-space: nowrap;"><{$val.order_items_nums}></td>

                <td style="white-space: nowrap;"><{$val.order_items_sendnum}></td>

                <td style="white-space: nowrap;"><{$val.order_items_return_num}></td>

                -->

                <td style="white-space: nowrap;"><{$val.order_items_pmt_price_single}></td>

                <td style="white-space: nowrap;"><{$val.order_items_pmt_bn_sigle}></td>

                <td style="white-space: nowrap;"><{$val.order_items_discount_bn_sigle}></td>

                <td style="white-space: nowrap;"><{$val.order_items_cost_freight_bn_sigle}></td>

                <td style="white-space: nowrap;"><{$val.order_items_cost_protect_single}></td>

                <td style="white-space: nowrap;"><{$val.order_items_cost_tax_single}></td>

                <td style="white-space: nowrap;"><{$val.order_items_pmt_single}></td>

                <!--

                <td style="white-space: nowrap;"><{$val.delivery_detail_amount}></td>

                <td style="white-space: nowrap;"><{$val.delivery_detail_price}></td>

                -->

                <td style="white-space: nowrap;"><{$val.delivery_detail_pmt_amount}></td>

                <td style="white-space: nowrap;"><{$val.delivery_detail_pmt_price}></td>

                <td style="white-space: nowrap;">
                <{$val.order_items_price}>
                </td>

                <td style="white-space: nowrap;"><{$val.delivery_detail_cost_freight}>
                </td>

                <td style="white-space: nowrap;"><{$val.axorderno}></td>

                <td style="white-space: nowrap;"><{$val.axshipno}></td>

                <td style="white-space: nowrap;"><{$val.logi_no}></td>

                <td style="white-space: nowrap;"><{$val.logi_name}></td>

                <td style="white-space: nowrap;"><{$val.t_ready}></td>

                <td style="white-space: nowrap;"><{$val.t_count}></td>

                <td style="white-space: nowrap;"><{$val.t_money}></td>

                <td style="white-space: nowrap;"><{$val.remark}></td>

                <td style="white-space: nowrap;"><{$val.ship_area|region}></td>

                <td style="white-space: nowrap;"><{$val.ship_addr}></td>

            </tr>

            <{/foreach}>


            </tbody>

        </table>

    </div>


    <div class="division">

    </div>

    <div class="gridlist-footer"><{$pager}></div>


</div>

